package com.example.account.feign;

import com.example.account.dto.AccountDTO;
import com.example.rest.RestBody;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "account-service")
public interface AccountFeign {

    @GetMapping("/account/{code}")
    RestBody<?> getByCode(@PathVariable(value = "code")String code);

    @PostMapping("/account/add")
    RestBody<?> addOrUpdate(@RequestBody AccountDTO accountDTO);

    @PostMapping("/account/deduct/amount")
    RestBody<?> deductAmount(@RequestBody AccountDTO accountDTO);
}
